import 'package:flutter/material.dart';
import 'package:flutterroom/pages/home/info/data.dart';
import 'package:flutterroom/pages/home/widgets/common_image.dart';

class InfoItemWidget extends StatelessWidget {
  final InfoItem data;

  const InfoItemWidget(this.data, {Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100,
      padding: EdgeInsets.only(bottom: 10,right: 10,left: 10),
      child: Row(
        children: <Widget>[
          CommonImage(
            data.imageUri,
            width: 120,
          ),
          Padding(padding: EdgeInsets.all(10)),
          Expanded(
              child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              Text(
                data.title,
                overflow: TextOverflow.ellipsis,
                maxLines: 3,
                style:
                    TextStyle(color: Colors.black, fontWeight: FontWeight.w500),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Text(data.source),
                  Text(data.time),
                ],
              )
            ],
          ))
        ],
      ),
    );
  }
}
